package org.example.javawebday1.controller;

import com.aliyuncs.exceptions.ClientException;
import org.example.javawebday1.pojo.Emp;
import org.example.javawebday1.pojo.EmpQueryForm;
import org.example.javawebday1.pojo.Result;
import org.example.javawebday1.service.EmpsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@RestController
@RequestMapping("/emps")
public class EmpsController {
    @Autowired
    private EmpsService empsService;



    @GetMapping
    public Result getEmps(EmpQueryForm empQueryForm)
    {
        return empsService.getEmps(empQueryForm);
    }

    @PostMapping
    public Result addEmps(@RequestBody Emp emp)
    {
        return empsService.addEmps(emp);
    }

    @DeleteMapping
    public Result deleteEmps(@RequestParam("ids") Integer[] ids) {
        return empsService.deleteEmps(ids);
    }

    @GetMapping("/{id}")
    public Result getEmpById(@PathVariable("id") Integer id) {
        return empsService.getEmpById(id);
    }

    @PutMapping
    public Result updateEmp(@RequestBody Emp emp) {
        return empsService.updateEmp(emp);
    }




}
